package com.example.lxj.sources.service.impl;

import java.util.List;

import cn.hutool.core.date.DateUtil;
import com.example.lxj.sources.entity.TbMaterials;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.lxj.sources.mapper.TbMaterialsMapper;
import com.example.lxj.sources.service.ITbMaterialsService;

/**
 * 鉴定材料Service业务层处理
 * 
 * @author lxj
 * @date 2024-10-15
 */
@Service
public class TbMaterialsServiceImpl implements ITbMaterialsService 
{
    @Autowired
    private TbMaterialsMapper tbMaterialsMapper;

    /**
     * 查询鉴定材料
     * 
     * @param materialsId 鉴定材料主键
     * @return 鉴定材料
     */
    @Override
    public TbMaterials selectTbMaterialsByMaterialsId(Long materialsId)
    {
        return tbMaterialsMapper.selectTbMaterialsByMaterialsId(materialsId);
    }

    /**
     * 查询鉴定材料列表
     * 
     * @param tbMaterials 鉴定材料
     * @return 鉴定材料
     */
    @Override
    public List<TbMaterials> selectTbMaterialsList(TbMaterials tbMaterials)
    {
        return tbMaterialsMapper.selectTbMaterialsList(tbMaterials);
    }

    /**
     * 新增鉴定材料
     * 
     * @param tbMaterials 鉴定材料
     * @return 结果
     */
    @Override
    public int insertTbMaterials(TbMaterials tbMaterials)
    {
        tbMaterials.setCreateTime(DateUtil.date());
        return tbMaterialsMapper.insertTbMaterials(tbMaterials);
    }

    /**
     * 修改鉴定材料
     * 
     * @param tbMaterials 鉴定材料
     * @return 结果
     */
    @Override
    public int updateTbMaterials(TbMaterials tbMaterials)
    {
        tbMaterials.setUpdateTime(DateUtil.date());
        return tbMaterialsMapper.updateTbMaterials(tbMaterials);
    }

    /**
     * 批量删除鉴定材料
     * 
     * @param materialsIds 需要删除的鉴定材料主键
     * @return 结果
     */
    @Override
    public int deleteTbMaterialsByMaterialsIds(Long[] materialsIds)
    {
        return tbMaterialsMapper.deleteTbMaterialsByMaterialsIds(materialsIds);
    }

    /**
     * 删除鉴定材料信息
     * 
     * @param materialsId 鉴定材料主键
     * @return 结果
     */
    @Override
    public int deleteTbMaterialsByMaterialsId(Long materialsId)
    {
        return tbMaterialsMapper.deleteTbMaterialsByMaterialsId(materialsId);
    }
}
